<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>

<head>
    <title>路线管理</title>


</head>

<body>

<div class="container">
    <div div="row">

        <div class="col-sm-10">
            <c:if test="${success!=null}">
                <div class="row">
                    <div class="alert alert-success">保存成功</div>
                </div>
            </c:if>

            <div class="row">
                <div class="panel panel-default">
                    <div class="panel-heading">路线详情</div>
                    <div class="panel-body">
                        <sf:form role="form" class="form-horizontal" method="post" action="${ctx}/workbench/line/detail?id=${companyLine.id}"
                                 commandName="companyLine">
                            <div class="row">
                                <input type="hidden" name="id" value="${companyLine.id}">

                                <div class="form-group">
                                    <label for="inputStartLocation" class="col-sm-2 control-label">始发:</label>

                                    <div class="col-sm-3">
                                        <div class="input-group">
                                            <input id="inputStartLocation" name="startLocation.locationName"
                                                   value="${companyLine.startLocation.locationName}" type="text"
                                                   class="form-control" placeholder="选择始发地" readonly>
                                            <input id="inputStartLocationHidden" name="startLocation.locationId"
                                                   value="${companyLine.startLocation.locationId}" type="hidden"
                                                   class="form-control" placeholder="">

                                            <div class="input-group-btn">
                                                <button id="btnStartLocation" type="button" class="btn btn-default"   data-toggle="tooltip" data-placement="right"  title="不能修改始发地">
                                                    <span class="glyphicon glyphicon-globe"></span></button>
                                            </div>
                                        </div>
                                        <div class="help-block with-errors">
                                            <sf:errors path="startLocation" cssClass="alert alert-danger"
                                                       element="div"></sf:errors>
                                        </div>
                                    </div>

                                </div>
                                <div class="form-group">
                                    <label for="inputEndLocation" class="col-sm-2 control-label">终点:</label>

                                    <div class="col-sm-3">
                                        <div class="input-group">
                                            <input id="inputEndLocation" name="endLocation.locationName"
                                                   value="${companyLine.endLocation.locationName}" type="text"
                                                   class="form-control" placeholder="选择终点" readonly>
                                            <input id="inputEndLocationHidden" name="endLocation.locationId"
                                                   value="${companyLine.endLocation.locationId}" type="hidden"
                                                   class="form-control" placeholder="">
                                                <span class="input-group-btn">
                                            <button id="btnEndLocation" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="不能修改终点" ><span
                                                    class="glyphicon glyphicon-globe"></span></button>
                                                </span>
                                        </div>
                                        <div class="help-block with-errors">
                                            <sf:errors path="endLocation" cssClass="alert alert-danger"
                                                       element="div"></sf:errors>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">单双向:</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="isTwoWay" id="radioIsTwoWay1" value="1"
                                               <c:if test="${companyLine.isTwoWay==1||companyLine.isTwoWay==null}">checked</c:if>>
                                        单向
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="isTwoWay" id="radioIsTwoWay2" value="2"
                                               <c:if test="${companyLine.isTwoWay==2}">checked</c:if> > 双向
                                    </label>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">时效:</label>

                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <input type="number" class="form-control" placeholder="" name="duration"
                                                   value="${companyLine.duration}">
                                            <span class="input-group-addon">天</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">

                                    <label class="col-sm-2 control-label">最低一票:</label>

                                    <div class="col-sm-2">
                                        <div class="input-group">
                                            <input type="number" class="form-control" placeholder="" name="minPrice"
                                                   value="${companyLine.minPrice}">
                                            <span class="input-group-addon">元</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-2">
                                        <div class="checkbox">
                                            <label>
                                                <input type="checkbox" value="1" name="isRecommend"
                                                       <c:if test="${companyLine.isRecommend==1}">checked</c:if>>是否推广
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2  control-label">

                                        <h4>价格</h4></label>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">重货整车</label>

                                    <div class="col-sm-3">
                                        <div class="input-group">
                                                <%--<span class="input-group-addon">--%>
                                                <%--<input type="checkbox"  name="ifPrice1">--%>
                                                <%--</span>--%>
                                            <input type="number" name="prices[0].price"
                                                   value="${companyLine.prices[0].price}" class="form-control">
                                            <input type="hidden" name="prices[0].unitId" value="1"/>
                                            <input type="hidden" name="prices[0].goodsType" value="1"/>
                                            <span class="input-group-addon">元/公斤</span>
                                        </div>

                                    </div>

                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2  control-label">重货零担</label>

                                    <div class=" col-sm-3">
                                        <div class="input-group">
                                                <%--<span class="input-group-addon">--%>
                                                <%--<input type="checkbox"  name="ifPrice2">--%>
                                                <%--</span>--%>
                                            <input type="number" name="prices[1].price"
                                                   value="${companyLine.prices[1].price}" class="form-control">
                                            <input type="hidden" name="prices[1].unitId" value="1"/>
                                            <input type="hidden" name="prices[1].goodsType" value="2"/>
                                            <span class="input-group-addon">元/公斤</span>
                                        </div>

                                    </div>

                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2  control-label">泡货零担</label>

                                    <div class="col-sm-3">
                                        <div class="input-group">
                                                <%--<span class="input-group-addon">--%>
                                                <%--<input type="checkbox" name="ifPrice3">--%>
                                                <%--</span>--%>
                                            <input type="number" name="prices[2].price"
                                                   value="${companyLine.prices[2].price}" class="form-control">
                                            <input type="hidden" name="prices[2].unitId" value="3"/>
                                            <input type="hidden" name="prices[2].goodsType" value="3"/>
                                            <span class="input-group-addon">元/立方</span>
                                        </div>

                                    </div>

                                </div>

                                <!-- /input-group -->
                                <button type="submit" class="btn btn-warning col-sm-offset-2">保存</button>
                                <button type="button" class="btn btn-warning"
                                        onclick="javascript:window.location='${ctx}/workbench/lines'">返回
                                </button>
                            </div>
                        </sf:form>
                    </div>

                </div>

            </div>


        </div>

    </div>
</div>


<!-- Large modal -->

<div id="myRegionSelectorModal" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog"
     aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">地区选择</h4>
            </div>
            <div class="modal-body">
                <div class="container" id="divRegionSelector"></div>
            </div>

        </div>
    </div>
</div>


<script src="${ctx}/statics/echarts/echarts.min.js"></script>
<script src="${ctx}/statics/js/regionselector.js"></script>

<script type="application/javascript">
    <%--var success = "${success}";--%>
    <%--if (success != null && success != "" && success != undefined) {--%>
        <%--showMyDialog("温馨提示", "线路创建成功", function () {--%>
            <%--window.location = "${ctx}/workbench/lines"--%>
        <%--}, "sm");--%>
    <%--}--%>
</script>

<script>
    $(function () {
        $("#linemanagement-tab").addClass("active");
        $("[data-toggle='tooltip']").tooltip();
        //地图选择器
//        var myRegionSelector = regionselector.init('divRegionSelector');
//        myRegionSelector.click(function (param) {
//            alert(param.value);
//
//        });

        //始发地选择
//        $('#btnStartLocation').click(function () {
//            myRegionSelector.reset();
//            $('#myRegionSelectorModal').modal();
//            myRegionSelector.click(function (param) {
//                $('#inputStartLocation').val(param.text);
//                $('#inputStartLocationHidden').val(param.value);
//                $('#myRegionSelectorModal').modal('hide');
//
//            });
//        });

        //终点地选择
//        $('#btnEndLocation').click(function () {
//            myRegionSelector.reset();
//            $('#myRegionSelectorModal').modal();
//            myRegionSelector.click(function (param) {
//                $('#inputEndLocation').val(param.text);
//                $('#inputEndLocationHidden').val(param.value);
//                $('#myRegionSelectorModal').modal('hide');
//
//            });
//        });

    })
</script>

</body>

</html>